<?php
include_once("conServer.php");
$id=$_POST["id"];
$name=$_POST["username"];
$age=$_POST["age"];
$result=$_POST["result"];
echo $id."---".$name."---".$age."---".$result;
$sql="";
if($id!=""||$id!=null){
    $sql="UPDATE result set name='".$name."',age=".$age.",result=".$result." where id=".$id;
}else{
    $sql="INSERT into result (name,age,result) values('".$name."',".$age.",".$result.")";
};
echo $sql;
if($sql!=""){
    if ($conn->query($sql)){
        echo"更新成功";
    }else{
        echo "Error".$conn->error;
    }
    $conn->close();
}else{
    echo"未知数据";
};

header("location:../index.php");
?>